

import Pure from 'pure-frontend';
import $ from 'jquery';
import { uiUtils } from '../common/js/ui-utils/ui-utils-all';

/* SOURCE-CODE-START */

"use strict";

$(function () {

  $('#refreshFrontConfigLink').on('click', function (event) {

    // 刷新前端上下文
    Pure.fn.Ajax.callService('dev/refreshFrontContext')
      .thenResult(function (result) {
        if (uiUtils.common.checkWebResultSuccess(result)) {
          Pure.app.showMessage('${t("ui.dev.common.msg.refreshConfigSuccess")}');
        }
      });
  });

  // 判断是否需要显示开发工具
  Pure.fn.Ajax.callService('dev/getFrontConfig')
    .thenResult(function (result) {
      if (uiUtils.common.checkWebResultSuccess(result)) {

        if (result.data.showDevTools) {
          $('body').removeClass('home-default')
            .addClass('home-dev');
        }
      }
    });

});

/* SOURCE-CODE-END */
